接下來幾天要實現我們Tauri後端的功能,這裡我們使用sqlite來當作我們的database
首先,簡單介紹下SQLite。SQLite是關聯式資料庫管理系統,被包含在一個相對小的C lib裡。SQLite常常被整合在使用者程式中。
接著我們開始安裝,我們到todo\src-tauri\Cargo.toml
並將rusqlite加入。
在dependecy加入rusqlite = { version = "0.28.0", features = ["bundled"] }
[package]
name = "todo"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
edition = "2021"
rust-version = "1.57"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "1.1", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.1", features = ["api-all"] }
rusqlite = { version = "0.28.0", features = ["bundled"] }
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]
接著,我們在終端進入src-tauri
目錄下執行cargo build
此時我們已經安裝好rusqlite
,明天接著實做Tauri後端的Todo功能